package com.liao.learntest.job;

import java.util.*;

/**
 * @author: liaowenqiang
 * @date: 2024/11/16 12:53
 * @description: 结算业务服务工厂
 **/
public class SettlementBusinessServiceFactory {

   static Map<SettlementStatusEnum, BusinessSevice> map = new LinkedHashMap(){{
        put(SettlementStatusEnum.STEP_01, new BusinessSevice() {
            @Override
            public boolean run(String taskId) {
                return false;
            }
        });
        put(SettlementStatusEnum.STEP_02, new BusinessSevice() {
            @Override
            public boolean run(String taskId) {
                return false;
            }
        });
        put(SettlementStatusEnum.STEP_03, new BusinessSevice() {
            @Override
            public boolean run(String taskId) {
                return false;
            }
        });
        put(SettlementStatusEnum.STEP_04, new BusinessSevice() {
            @Override
            public boolean run(String taskId) {
                return false;
            }
        });
    }};


    public static Set<SettlementStatusEnum> getSettlementStatusEnums(){
        return map.keySet();
    }

    public static BusinessSevice getBySettlementStatus(SettlementStatusEnum settlementStatusEnum){
        return map.get(settlementStatusEnum);
    }
    public static SettlementStatusEnum getNextSettlementStatusEnum(SettlementStatusEnum settlementStatusEnum){

        boolean found = false;
        for (SettlementStatusEnum statusEnum : map.keySet()) {
            if(found){
                return statusEnum;
            }
            if(Objects.equals(statusEnum,settlementStatusEnum)){
                found=true;
            }
        }
        return null;
    }
}
